package com.company.aop;


import com.company.Website;
import com.company.WebsiteImpl;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class DynamicProxyMain {

    public static void main(String[] args) {
        //生成代理工厂
        InvocationHandler invocationHandler = new DynamicProxy(new WebsiteImpl());
        //代理工厂生成代理对象
        Website website = (Website) Proxy.newProxyInstance(
                DynamicProxyMain.class.getClassLoader(),
                new Class[]{Website.class}, invocationHandler);
        website.request();
        website.response();
    }

}
